Various kinds of devices such as a MEMS device, a CCD or CMOS element, and a liquid crystal have been widely employed as a compact, lightweight and high-performance device. These devices are easily influenced by the external environment because of a delicate electrode material and structure thereof, and thus, the devices are used in an airtightly-packaged manner in order to avoid this influence. In addition, in recent years, a similar airtightly-packaged image sensor has been employed within a camera module of a mobile phone, thereby responding to a demand for price reduction, in addition to size reduction, thickness reduction and weight reduction. For example, as described in Japanese Patent Laying-Open No. 10-107240 (Patent Document 1) and Japanese Patent Laying-Open No. 2006-140384 (Patent Document 2), in an image sensor including a CCD or CMOS element, after the sensor is housed in a ceramic package, electrical connection is made by wire bonding and sealing is performed by using a transparent lid such as glass. In addition, as described in Japanese Patent Laying-Open No. 2007-312012 (Patent Document 3) and U.S. Pat. No. 6,777,767 (Patent Document 4), a method for implementing CSP (Chip Size Packaging) to reduce the size of an overall image sensor is known. In these cases, a hole or a groove that passes to the surface from the rear surface of a semiconductor silicon wafer having a CCD or CMOS element formed is provided, the front side is electrically connected to the rear side, and connection to an external circuit is made by a ball bump arranged on the rear surface of the semiconductor wafer.